<?php

/*

  Action	$5

  You may reveal a Province card from your hand. If you do, gain a Gold card, putting it into your hand.
  Otherwise, gain a Silver card, putting it into your hand.

 */

class Explorer extends Card implements iAction, iKingdom, iSeaside {

    public function __construct() {
        parent::__construct("Explorer", 5);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "You may reveal a Province card from your hand. If you do, gain a Gold card, putting it into your hand.",
            "Otherwise, gain a Silver card, putting it into your hand.");
    }
    
    public function play(Game $game, $isRealCard) {
        $province = $game->getCardInHand("Province");
        if ($province != null) {

            $options = array(new Option(1, "Yes"), new Option(2, "No"));
            $output = MySocket::GetUserReply($game, Input_ChooseOne, $options, 1, 1, null, "Reveal a province?");
            $answer = $output[0];
            if ($answer == "Yes") {
                $card = $game->moveCardFromPileToPile("Gold", BoardCards, PlayHand);
                 ScreenDisplay::addScreenMessage($game, true, "reveal a Province and get " . nicePrint($card), "reveals a Province and gets " . ScreenDisplay::$LMSG);
            } else {
                $card = $game->moveCardFromPileToPile("Silver", BoardCards, PlayHand);
                 ScreenDisplay::addScreenMessage($game, true, "dont reveal a Province and get " . nicePrint($card), "doesnt reveal a Province and gets " . ScreenDisplay::$LMSG);
            }
        } else {
            $card = $game->moveCardFromPileToPile("Silver", BoardCards, PlayHand);
             ScreenDisplay::addScreenMessage($game, true, "dont reveal a Province and get " . nicePrint($card), "doesnt reveal a Province and gets " . ScreenDisplay::$LMSG);
        }

        $game->cardActionFinished();
        return true;
    }

}

?>